package com.yz.crm.passport.model;

import java.util.List;

import com.yz.crm.db.model.BaseCompany;
import com.yz.crm.db.model.BaseEmployee;
import com.yz.crm.db.model.BaseRole;
import com.yz.crm.system.constant.SpecialRoleEnum;

/**
 * 登录用户
 * */
public class SessionUser {

	private BaseCompany company;
	
	private BaseEmployee employee;
	
	private List<BaseRole> roleList;
	
	/**
	 * 是否管理员
	 * */
	public boolean isAdmin(){
		
		if (roleList==null){
			return false;
		}
		
		for (BaseRole role : roleList){
			if (role.getCode().equals(SpecialRoleEnum.CompanyAdmin.getCode())){
				return true;
			}
		}
		return false;
	}
	

	public BaseCompany getCompany() {
		return company;
	}

	public void setCompany(BaseCompany company) {
		this.company = company;
	}

	public BaseEmployee getEmployee() {
		return employee;
	}

	public void setEmployee(BaseEmployee employee) {
		this.employee = employee;
	}


	public List<BaseRole> getRoleList() {
		return roleList;
	}


	public void setRoleList(List<BaseRole> roleList) {
		this.roleList = roleList;
	}
	
}
